// 观察者
export class Observer {
    constructor(public Name: string, public 美女有任何动作然后就: Function) {
        this.Name = Name;
        this.美女有任何动作然后就 = 美女有任何动作然后就;
    }
    update(...val) {
        this.美女有任何动作然后就.call(this)
    }
}
// 观察者列表
export class ObserverList {
    observerList: Array<Observer>;
    constructor() {
        this.observerList = []
    }
    public add(observer: Observer) {
        return this.observerList.push(observer);
    }
    public remove(observer) {
        this.observerList = this.observerList.filter(ob => ob !== observer);
    }
    public count() {
        return this.observerList.length;
    }
    public get(index) {
        return this.observerList[index];
    }
}
// 目标
export class Subject {
    observers: ObserverList;
    constructor() {
        this.observers = new ObserverList();
    }
    public addObserver(observer) {
        this.observers.add(observer);
    }
    public removeObserver(observer) {
        this.observers.remove(observer);
    }
    public notify(...args) {
        let obCount = this.observers.count();
        for (let index = 0; index < obCount; index++) {
            this.observers.get(index).update(...args);
        }
    }
}